Search (Object)
The Search object represents an instantiated instance of embedded search - generated by calling the search method.
Constructors
- There is NO constructor for Search object.
Methods
- hideSearch(): void- method to hide the search text box.
- showSearch(): void - method to show the search text box
- save(): Promise <{id: string, name: string}> - method to save the generated visual
Comments
Since content produced via embedded search is temporary, developers may want to offer end users the option to save content to Pyramid permanently. This requires the use of the "Save" method. However, it will be saved to the private folder of the user running the session. As such, in named embedding, it will be saved to the specific users domain. While for anonymous embedding, the results will be saved to the folder of the hidden user account running the session.
With that in mind, saving content in anonymous scenarios makes little sense.
Example
The following snippet calls the search method. The "searchObj" is returned from the method, and different functions are called.
const embedClient = new PyramidEmbedClient('http://pyramid:8181');
const searchObj = await embedClient.search(searchContainer, previewContainer, embedSearchOptions);
// Hide the search
searchObj.hideSearch();
// Show the search
searchObj.showSearch();
// Save the generated report to the private content folder in Pyramid
const result = await searchObj.save();